using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using CodeStory.Core.UI;
using CodeStory.News.ObjectEntity;
using Activa.CoolStorage;

namespace CodeStory.WebApplication.News.Admin
{
	public partial class NewsManager : Portlet
	{
		protected override void OnInit(EventArgs e) {
			Load += new EventHandler(NewsManager_Load);
			base.OnInit(e);
		}

		void NewsManager_Load(object sender, EventArgs e) {
			//throw new Exception("The method or operation is not implemented.");
			if (!IsPostBack) {
				BindCategory();
				BindNews();
			}
		}
		private void BindCategory() {
			//throw new Exception("The method or operation is not implemented.");
			CSList<NewsCategoryObject> list = NewsCategoryObject.List();
			dpdCategory.DataSource = list;
			dpdCategory.DataTextField = "CategoryName";
			dpdCategory.DataValueField = "CategoryID";
			dpdCategory.DataBind();
		}

		private void BindNews() {
			CSList<NewsContentObject> list = NewsContentObject.List();
			gvNews.DataSource = list;
			gvNews.DataBind();
		}
	}
}